package com.zdkj.common.core.exceltools.impl;

import com.zdkj.common.core.exceltools.AbstractExcelParser;
import com.zdkj.common.core.exceltools.IExcelParser;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.Sheet;
import org.springframework.stereotype.Service;

import javax.sql.DataSource;
import java.util.List;

/**
 * @ProjectName: zdkj
 * @Package: com.zdkj.subway.st.exceltools.impl
 * @ClassName: CommonExcelParse
 * @Description:
 * @Author: kangjian
 * @CreateDate: 2020/1/12 12:58
 * @Version: 1.0
 */
@Slf4j
@Service
public class CommonExcelParse<T>  extends AbstractExcelParser implements IExcelParser<T> {
    @Override
    public <T> List<T> parse(Sheet sheet, DataSource ds, T obj) {
        List<T> result= null;
        try {
            result = super.importBaseExcel(sheet,obj);
        } catch (Exception e) {
            log.error("",e);
        }
        return result;
    }

    @Override
    public <T> List<T> parse(Sheet sheet, T obj) {
        List<T> result=this.parse(sheet,null,obj);
        return result;
    }
}
